# Westmetal Document Services
from pentacle.architecture import ServiceBase
from webbrowser import get as getBrowser

class DocumentBrowserManager(ServiceBase):
    NAME = '@westmetal/document/browser'
    WINDOW = dict(normal = 0, new = 1, tab = 2)
    def openUrl(self, url, window = 'normal', autoraise = True, browser = None):
        browser = getBrowser(browser)
        browser.open(url, new = self.WINDOW[window], autoraise = bool(autoraise))
